//Copyright (c) Microsoft Corporation.  All rights reserved.

using System;
using System.Collections.Generic;
using System.Text;

namespace Eas.WebCrawler.PlugIns.UrlProcessedHandlers {
    /// <summary>A base class for classes that handle the <see cref="Eas.WebCrawler.Interfaces.WebCrawlerEvents.UrlProcessed"/> notification of the web crawler by delegating to an inner handler.</summary>
    public class DelegatingUrlProcessedHandler : UrlProcessedHandler{
        /// <summary>Constructs a <see cref="DelegatingUrlProcessedHandler"/> from an inner processor.</summary>
        /// <param name="innerHandler">The inner processor to which derived classes can delegate.</param>
        public DelegatingUrlProcessedHandler(UrlProcessedHandler innerHandler) {
            _InnerHandler = innerHandler;
        }

        /// <summary>The inner handler that gets called.</summary>
        /// <remarks>Backing field for the InnerHandler property.</remarks>
        /// <seealso cref="InnerHandler"/>
        private UrlProcessedHandler _InnerHandler;

        /// <summary>The inner handler that gets called.</summary>
        public UrlProcessedHandler InnerHandler {
            get { return _InnerHandler; }
        }

        #region UrlProcessedHandler Members
        /// <summary>Handles the <see cref="Eas.WebCrawler.Interfaces.WebCrawlerEvents.UrlProcessed"/> event fired by the web crawler when registered to do so.</summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="argument">Details of the processed url.</param>
        public void UrlProcessed(object sender, Eas.WebCrawler.Interfaces.UrlCompletedEventArgs argument) {
            _InnerHandler.UrlProcessed(sender, argument);
        }
        #endregion
    }
}
